package com.naml.e_filereader;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/22 22:01
 * @desc 读取文本的内容到程序中
 */
@SuppressWarnings("all")
public class FileReader01 {
    public static void main(String[] args) {
        FileReader fileReader = null;
        try {
            fileReader = new FileReader("/Users/marin/new3.txt");
            //单个字符读取
            int length = 0;
            while ((length = fileReader.read()) != -1){
                System.out.print((char) length);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
